package com.haoke.login.controller;

import com.haoke.commons.vo.HaokeResult;
import com.haoke.login.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yue13
 * 登录服务控制器
 */
@RestController
@CrossOrigin
public class LoginController {
    @Autowired
    private LoginService loginService;

    /**
     * 用户登录
     *
     * @param username 手机号
     * @param password 验证码
     * @return
     */
    @PostMapping("/login")
    public HaokeResult login(String username, String password) {
        return loginService.login(username, password);
    }


    /**
     * 发送验证码
     *
     * @param phone   手机号码
     * @return
     */
    @PostMapping("/sendyzm")

    public HaokeResult sendyzm(String phone) {

        return loginService.sendyzm(phone);

    }
}
